<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!--<link href="css/list.css" rel="stylesheet" />-->
		<script src="../../js/mui.min.js"></script>
		 <script src="../../js/app.js"></script>
		 <!--<link href="css/style.css" rel="stylesheet" />-->
		 <link href="../../css/mui.min.css" rel="stylesheet" />
		 <!--<link href="../../css/mui.picker.css" rel="stylesheet"/>-->
        <!--<link href="../../css/mui.poppicker.css" rel="stylesheet" />-->
		 		<style type="text/css">
</style>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">实名认证</h1>
	</header>
<!--	<div id="crop_result" style="display:none;text-align: center;width: 100%; padding-top: 30px; height: 230px; line-height: 300px;"><span><img id="headimg" style="display:block;margin: 0 auto" src="" alt="" /></span></div>-->
<div class="mui-content" style="display:block;">
    <form class="mui-input-group" name="myform">
      	    <div class="mui-input-row">
      	        <label>企业名称</label>
      	        <input type="text" id="name" class="mui-input-clear" placeholder="请输入(不超过20字)">
      	    </div>
      	    <div class="mui-input-row">
      	        <label>法人姓名</label>
      	        <input type="text" id="name2" class="mui-input-clear" placeholder="请输入(不超过10字)">
      	    </div>
      	    <div class="mui-input-row">
      	        <label>联系电话</label>
      	        <input type="text" id="phone" class="mui-input-clear" placeholder="请输入(不超过10字)">
      	    </div>
      	    <div class="mui-input-row">
      	        <label>出生日期</label>
      	        <input type="text"  id='birthday' onclick="datarow(this)" class="mui-input-clear" placeholder="2019-12-20"style="float:left;width: 30%;" placeholder="12"><label style="float: left;width: 90px;padding-left: 0;">日</label>
      	    </div>

      	    <div class="mui-input-row">
      	        <label>您的职位</label>
				   <select id="sex"style="width:65%;">
				  <option value="法人">法人</option>
				  <option value="股东">股东</option>
				  <option value="总经理">总经理</option>
				  <option value="其他">其他</option>
				 </select> 
      	    </div>
      	    <div class="mui-input-row">
      	        <label>认证类别</label>
		  	 	<select id="world"style="width:65%;">
			 	</select> 
      	    </div>

      	    <div class="mui-input-row">
      	        <label>户籍地址</label>
      	        <input type="text" id="address"  class="mui-input-clear" placeholder="请与身份证保持一致" >
      	    </div>
      	    <div class="mui-input-row">
      	        <label>证件有效期</label>
      	        <input type="text"  id='deadline' onclick="datarow(this)" class="mui-input-clear" placeholder="2019-12-20"style="float:left;width: 30%;" placeholder="12"><label style="float: left;width: 90px;padding-left: 0;">日</label>
      	    </div>
      	    <div class="mui-input-row">
      	        <label>证件号码</label>
      	        <input type="text"  id='code' class="mui-input-clear" placeholder="210880199908025517"style="float:left;" placeholder="21"><label style="float: left;width: 90px;padding-left: 0;"></label>
      	    </div>
      	    <ul class="mui-table-view">
			        <li class="mui-table-view-cell ">手持营业执照及身份证(添加图片)
					<ul class="mui-table-view" >
						<!--<span onclick="goto('microblog','admin','publish','')">发布帖子</span>-->
						 <div class="mui-table-view-cell"  style="max-width:99%;text-align:center;" onclick="image('image1')">
						    <img  style="margin: 1% 8%;width: 80%;height: auto"  id="image1"  src="" onerror="Javascript:this.src='../img/auth_co1.jpg'"/>
						</div>
					</ul>
        			</li>
      	    </ul>
      	    <ul class="mui-table-view">
			        <li class="mui-table-view-cell ">营业执照正面(添加图片)
					<ul class="mui-table-view" >
						<!--<span onclick="goto('microblog','admin','publish','')">发布帖子</span>-->
						 <div class="mui-table-view-cell"  style="max-width:99%;text-align:center;" onclick="image('image2')">
						    <img  style="margin: 1% 8%;width: 80%;height: auto"  id="image2"  src="" onerror="Javascript:this.src='../img/auth_co2.jpg'"/>
						</div>
					</ul>
        			</li>
      	    </ul>
      	    <ul class="mui-table-view">
			        <li class="mui-table-view-cell ">开户许可证正面(添加图片)
					<ul class="mui-table-view" >
						<!--<span onclick="goto('microblog','admin','publish','')">发布帖子</span>-->
						 <div class="mui-table-view-cell"  style="max-width:99%;text-align:center;" onclick="image('image3')">
						    <img  style="margin: 1% 8%;width: 80%;height: auto"  id="image3"  src="" onerror="Javascript:this.src='../img/auth_co3.jpg'"/>
						</div>
					</ul>
        			</li>
      	    </ul>

      	</form> 

      	<button type="button" class="mui-btn mui-btn-blue" style="padding:7px;margin: 1%;width: 98%;font-size: 18;" onclick="tijiao()">提交</button>
      	<!--</div>-->
      </div>
      <!--<div>查看数据详单>>>></div>-->
</body>
<script type="text/javascript">	
//调用方式
	window.addEventListener('renovate', function(e){
		var imgs=JSON.parse(localStorage.image);
		//裁剪后返回的64base图片显示在image标签下的img
		document.getElementById(imgs.imgid).src=e.detail.image;
				//主图裁剪上传返回数据执行更新
//			  location.reload(); //刷新
			  });
//image('fdfd');
	function image(imgid){
		maxwh=1080;
		localStorage.image='{"imgid":"'+imgid+'","maxwh":"'+maxwh+'"}';
		mui.openWindow('../../Plugin/image/image.html');
	};
var optbJson={
		"world":{"营业执照":"营业执照"}
		 };
		 
for(var k in optbJson){
var rugufangshiche='';
var	obj = document.getElementById(k);
//	alert(k+optbJson[k]);
for(var p in optbJson[k]){//遍历json对象的每个key/value对,p为key
if(k=='world'){
rugufangshiche+='<option name="'+k+'" value="'+p+'">'+optbJson[k][p]+'</option>';	
}else{
rugufangshiche+='<div style="width: 49%;float: left;"><input name="'+k+'" value="'+p+'" type="checkbox" checked><label>'+optbJson[k][p]+'</label></div>';
}
}
obj.innerHTML=rugufangshiche;
}
function tijiao(){
	var sizenum=1;
	// 得到页面中所有input	
	var allInputs = document.getElementsByTagName('input');
	var libIds = [];
	// 在所有Input中过滤出type="text" and name="libID"的元素，放到数组libIds中  && allInputs[i].name === 'libname'
//	for (var i = 0; i < allInputs.length; i++) {
//		if (allInputs[i].type === 'text' && allInputs[i].name === 'libname') 
//		{
//			libIds.push(allInputs[i]);	
//			if(allInputs[i].value==''){
//			alert('您有表单未填写，请填写后提交');
////			return false;
//			}
//		}
//	}
	for(var kb in optbJson){
			var	objtj = document.getElementsByName(kb);
//  		alert(kb);
	    for(pb in objtj){
	        if(objtj[pb].checked){
	    	if(kb=='ways'){ways_val+=objtj[pb].value+',';};
	    }
    }}
	//生日
	var birthday_val = new Date(document.getElementById('birthday').value.replace(/-/g,'/'))/1000;
	//证件截至日期
	var deadline_val=new Date(document.getElementById('deadline').value.replace(/-/g,'/'))/1000;
mui.post(home.hos+'/auth/admin',Object.assign(apptoken,{
		act:'publish',
		mod:'company',
		name:document.getElementById('name').value,
		name2:document.getElementById('name2').value,
		phone:document.getElementById('phone').value,
		deadline:deadline_val,
		birthday:birthday_val,//出生日期
		sex:document.getElementById('sex').value,//性别
		code:document.getElementById('code').value,
		address:document.getElementById('address').value,//户籍地址
		image1:document.getElementById('image1').src,//手持身份证
		image2:document.getElementById('image2').src,//身份证正面
		image3:document.getElementById('image3').src,//身份证反面
	}),function(data){
		alert(data);
		if(data!=200){
			plus.ui.toast("发布失败,请重新尝试，错误码".data);
		}else{
				alert("发布成功");
				mui.back();
				var list = plus.webview.currentWebview().opener();
				//触发父页面的自定义事件(refresh),从而进行刷新
				 mui.fire(list, 'refresh');
				//返回true,继续页面关闭逻辑
				return true;
				}
		//服务器返回响应，根据响应结果，分析是否登录成功；

	},'text'
);}
function datarow(data){
	var dDate = new Date();
    //设置当前日期（不设置默认当前日期）
    dDate.setFullYear(2018, 7, 16);
    var minDate = new Date();
    //最小时间
    minDate.setFullYear(1930, 1, 1);
    var maxDate = new Date();
    //最大时间
    maxDate.setFullYear(2035, 11, 31);
    plus.nativeUI.pickDate(function(e) {
        var d = e.date;
        document.getElementById(data.id).value=d.getFullYear()+ "-" + (d.getMonth() + 1) + "-" + d.getDate();
        mui.toast('您选择的日期是:' + d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate());
    }, function(e) {
        mui.toast("您没有选择日期");
    }, {
        title: '请选择日期',
        date: dDate,
        minDate: minDate,
        maxDate: maxDate
    });
	
}



  </script>